package com.monkeyk.sos.utils;

import com.leimingtech.core.common.PropertiesLoader;
import com.monkeyk.sos.service.OauthRetrofitService;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by yun on 2017/8/13.
 */
public class RetrofitUtils {

    public static final String CLIENT_ID_UNITY = "unity-client";
    public static final String CLIENT_SECURITY_UNITY = "unity";
    public enum GrantType {
        authorization_code,
        password,
        refresh_token,
        implicit,
        client_credentials
    }
    public enum Scope {
        read,
        write,
        trust
    }

    private static PropertiesLoader propertiesLoader = new PropertiesLoader(new String[]{"spring-oauth-server.properties"});

    public static String oauthServerHost = propertiesLoader.getProperty("oauth.server.host");

    public static Retrofit retrofit = new Retrofit.Builder()
            .baseUrl(oauthServerHost)
            .addConverterFactory(GsonConverterFactory.create())
            .build();

    public static OauthRetrofitService getOauthRetrofitService() {
        return retrofit.create(OauthRetrofitService.class);
    }
}
